import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpService } from '../providers/HttpService';
import { environment } from '../../environments/environment';
import * as constants from './../providers/Constants'
@Injectable({
    providedIn: 'root'
})
export class ApiUtils {

    constructor(private http:HttpService) {
        
    }
    
    public getAMap(latitude:string='34.241909',longitude:string='108.898689') : Observable<any> {
        let url=environment.mapServerUrl+'?location='+longitude+','+latitude+'&key='+constants.AMAP_KEY;
        // https://restapi.amap.com/v3/geocode/regeo?output=xml&location=116.310003,39.991957&key=baec132dc2a523ecd0a93f155055fc33
        // https://restapi.amap.com/v3/geocode/regeolocation34.242043,108.898965&key=baec132dc2a523ecd0a93f155055fc33
        console.log('url==',url);
        return this.http.getSendBody(url);
    }
  
    
}
